package com.roden.study.examples.com.google.common;

import com.google.common.collect.Lists;

import org.junit.Test;

import java.util.List;

/**
 * @Author luodeng
 * @create 2021/9/26 10:44
 */
public class ListTest {
    @Test
    public void part(){
        //使用google guava对List进行分割
        List<Integer> intList = Lists.newArrayList(1, 2, 3, 4, 5, 6, 7, 8);
        //按每50个一组分割
        List<List<Integer>> parts = Lists.partition(intList, 5);
        parts.stream().forEach(list -> {
            System.out.println(list.size());
        });
    }
}
